﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace BDSim
{
    /// <summary>
    /// 消息状态转换到对应图标
    /// </summary>
    public class MessageStatus2ICO : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string img = "";
            if (value is OutputType)
            {
                switch ((OutputType)(value))
                {
                    case OutputType.消息:
                        img = @"/BDSim;component/Resources/Images/messageboxinfo.ico";
                        break;
                    case OutputType.错误:
                        img = @"/BDSim;component/Resources/Images/messageboxerror.ico";
                        break;
                    case OutputType.警告:
                        img = @"/BDSim;component/Resources/Images/messageboxalert.ico";
                        break;
                    default:
                        break;
                }
            }
            return img;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        //Image CreatImage(string imageName)
        //{
        //    string ImagePath = @"/BDSim;component/Resources/Images/" + imageName;
        //    Image myImage3 = new Image();
        //    BitmapImage bi3 = new BitmapImage();
        //    bi3.BeginInit();
        //    bi3.UriSource = new Uri(ImagePath, UriKind.Relative);
        //    bi3.EndInit();
        //    myImage3.Stretch = Stretch.Fill;
        //    myImage3.Source = bi3;
        //    myImage3.Height = 14;
        //    myImage3.Width = 14;
        //    return myImage3;
        //}
    }
}
